package org.jeecg.modules.quartz.job;

import com.alibaba.fastjson.JSONArray;
import com.baomidou.dynamic.datasource.annotation.DS;
import lombok.extern.slf4j.Slf4j;
import org.jeecg.board.service.LineBoardService;
import org.jeecg.board.service.PlantBoardService;
import org.jeecg.client.BizResponse;
import org.jeecg.client.SendUtils;
import org.jeecg.common.util.DateUtils;
import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicInteger;

@Slf4j
public class PlantBoardJob implements Job {

    private String parameter;

    @Resource
    private PlantBoardService plantBoardService;

    public void setParameter(String parameter) {
        this.parameter = parameter;
    }
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        //获取车间所有生产产线
        List<String> list = Arrays.asList(this.parameter.split(";"));
        Map<String, Object> a1 = new HashMap<>();
        for (int i = 0; i < list.size(); i++){
            Map<String, Object> map = new HashMap<>();
            map.put("line",list.get(i));
            plantBoardService.getPlantBoardProductionData(map);
        }


        log.info( String.format("welcome %s! 车间看板定时任务 SampleParamJob !   时间:" + DateUtils.now(), this.parameter));
    }
}
